import { TypeOrmModule } from "@nestjs/typeorm"
import { databaseConfig } from "./database"

import { ProgramModule } from "../app/program/program.module"
import { AdministratorModule } from "../app/administrator/administrator.module"
import { AuthorizationModule } from "../app/authorization/authorization.module"
import { WechatPayModule } from "../app/wechatPay/wechatPay.module"
import { PiracyModule } from "../app/piracy/piracy.module"
import { AliPayModule } from "../app/aliPay/aliPay.module"
import { OrderModule } from "../app/order/order.module"
import { UserModule } from "../app/user/user.module"
import { UploadModule } from "../app/upload/upload.module"
import { CopyrightModule } from "../app/copyright/copyright.module"
import { EmailModule } from "../app/email/email.module"

export const moduleConfig = [
  TypeOrmModule.forRootAsync({
    useFactory: databaseConfig // 异步配置数据库信息，确保环境变量优先加载
  }),
  ProgramModule,
  AdministratorModule,
  AuthorizationModule,
  WechatPayModule,
  PiracyModule,
  AliPayModule,
  OrderModule,
  UserModule,
  UploadModule,
  CopyrightModule,
  EmailModule
]
